package finalproject.model.items;

import finalproject.model.player.Player;
import finalproject.model.studies.Lab;
import finalproject.view.StringManager;

/**
 * This class represents a labitem, an item used to certify that a student passed the corresponding lab session
 * @author user Nicolas Bighetti
 *
 */
public class LabItem extends Item{

	/**
	 * The corresponding lab sessions
	 */
	private Lab labSession;
	
	/**
	 * The LabItem constructor
	 * @param labSession The lab session the item is associated to
	 */
	public LabItem(Lab labSession)
	{
		
		super(StringManager.getString("labitem"), StringManager.getString("labitemdescription"), 1, true, false, true);
		
		this.labSession = labSession;
	}
	
	@Override
	public void use(Player p) {
	    if(p.getEnergy().getEnergy() != 0)
	    {
	    p.getEnergy().setEnergy(p.getEnergy().getEnergy()-1);
		StringManager.outPutText(StringManager.getString("uselabitem") + " " + this.labSession.getTitle());
	    }
	    else
	    {
	       StringManager.outPutText(StringManager.getString("exhausted")); 
	    }
	}

	/**
	 * @return the labSession
	 */
	public Lab getLabSession() {
		return labSession;
	}

	/**
	 * @param labSession the labSession to set
	 */
	public void setLabSession(Lab labSession) {
		this.labSession = labSession;
	}
	
}
